# demo01_email.py   测试: mail -u 用户名
import smtplib
from email.mime.text import MIMEText  # 头部信息类
from email.header import Header  # 头部信息类
#          正文    类型:纯文本  编码
msg = MIMEText("python", "plain", "utf8")  # 邮件
msg["From"] = Header("nfx", "utf8")  # 添加头部信息
msg["To"] = Header("leader", "utf8")
msg["Subject"] = Header("qingjia", "utf8")
smtp = smtplib.SMTP("127.0.0.1")  # 创建邮件中转站
# root ---> bob & alice  msg.as_bytes():邮件转字节串
# 发件
smtp.sendmail("root",["bob","alice"],msg.as_bytes())











# rpm -q postfix || yum -y install postfix
# yum -y install mailx
# systemctl start postfix
# netstat -utnlp | grep :25
# [root@localhost xx]# useradd bob
# [root@localhost xx]# useradd alice
# vim /etc/hosts  # 把自己的主机名和127.0.0.1地址绑定
